<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="referrer" content="never">
    <title>堆糖</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        /* img {
            width: 100%;
            height: 100%;
        } */
    </style>
</head>

<body>
    <div id="box">
        <!-- <img src="" alt="">
        <h4></h4> -->
    </div>
</body>
<script>
    let box = document.querySelector('#box');

    let xhr = new XMLHttpRequest();
    let url = '/dt?include_fields=top_comments%2Cis_root%2Csource_link%2Citem%2Cbuyable%2Croot_id%2Cstatus%2Clike_count%2Csender%2Calbum%2Creply_count&filter_id=家居生活&start=24&_=1594428960369'
    xhr.open('GET', url);
    xhr.send();
    xhr.onreadystatechange = function () {
        if (xhr.readyState == 4 && xhr.status == 200) {
            // console.log(JSON.parse(xhr.responseText));
            let data = JSON.parse(xhr.responseText);
            let htmlStr = '';
            for (let i = 0; i < data.data.object_list.length; i++) {
                htmlStr += `<img src="${data.data.object_list[i].photo.path}" alt="">
                            <h4>${data.data.object_list[i].msg}</h4>`;
            }
            box.innerHTML = htmlStr;
        }
    }
</script>

</html>